<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<span id="${uuid}"></span>
<div class="box_tc_s">
    <div style="float: right;width: 300px;">
        <h3>已选择的结构</h3>
        <div data-id="chooseItem" class="choose-item-box">
            <div class="choose-tip">
                暂时未选择相关数据
            </div>
        </div>
    </div>
    <div style="margin-right: 305px;padding-right: 10px;border-right: 2px solid #2daacd">
        <h3>可选的结构列表</h3>
        <div class="grid-wrap" style="margin-top: 0">
            <table data-id="grid"></table>
        </div>
    </div>
</div>
<textarea data-id="hiddenTextArea" style="display: none"></textarea>
<div data-id="news_tb" class="nsdb">
    <a data-href="${pageContext.request.contextPath}/app/api/ebom/toSearch" data-key="search" iconCls="fa fa-search fa-lg"
       plain="true">搜索</a>
    <a data-href="#" data-key="search_all" iconCls="fa fa-refresh fa-lg" plain="true">搜索全部</a>
</div>
<div data-id="user_list_btn">
    <a data-href="#" data-id="{{id}}" data-key="view" iconCls="fa fa-eye fa-lg" plain="true">详情查看</a>
</div>
<script language="javascript">
    seajs.use("apps/ebom/choose", function(page){
        page.init("${pageContext.request.contextPath}", "${uuid}", {
            pbomId:"${condition.tPBom.id}",
            bomType:"${condition.bomType}"
        });
        var uuid = "${uuid}";
        $[uuid] = {
            pageFactory: page.pageFactory,
            getChooseData:page.getChooseData
        }
    });

    function choose_ebom_child(win){
        win.wait("start", "数据保存中,请稍候.");
        var pager = $["${uuid}"].pageFactory;
        var grid = pager.getJqDom("grid");
        if("${param['selected']}" == '1'){
            var choose = $["${uuid}"].getChooseData();
            if(!choose.length){
                $.messager.alert("信息", "至少需要选择一个工件");
                win.wait("end");
                return;
            }
        }
        win.callback(true, {
            formData:pager.getJqDom("hiddenTextArea").val(),
            postData:$["${uuid}"].getChooseData(),
            total:grid.datagrid("getPager").pagination("options").total
        });
        win.wait("end");
        win.close();
    }
</script>